<?php
/*
 * @Author: lokei
 * @Date: 2022-08-02 18:52:31
 * @LastEditors: lokei
 * @LastEditTime: 2022-08-16 23:32:59
 * @Description: 
 */

/** @var \Laravel\Lumen\Routing\Router $router */

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});

$router->group(['prefix' => 'auth'], function () use ($router) {
	// auth
	$router->post('logout', [
		'as' => 'logout', 'uses' => '\App\Http\Controllers\Auth\AuthController@logout'
	]);
	
	// admin
	$router->post('admin/login', [
		'as' => 'adminLogin', 'uses' => '\App\Http\Controllers\Auth\AdminController@login'
	]);
	$router->get('admin/info', [
		'as' => 'adminInfo', 'uses' => '\App\Http\Controllers\Auth\AdminController@info'
	]);
	
	// miniapp
	$router->post('miniapp/login', [
		'as' => 'miniappLogin', 'uses' => '\App\Http\Controllers\Auth\MiniappController@login'
	]);
});

$router->group(['prefix' => 'conf'], function () use ($router) {
	// conf
	$router->get('get', [
		'as' => 'getConf', 'uses' => '\App\Http\Controllers\Platform\ConfController@get'
	]);
	$router->post('update', [
		'as' => 'updateConf', 'uses' => '\App\Http\Controllers\Platform\ConfController@update'
	]);
	
	// miniapp conf
	$router->get('miniapp/get', [
		'as' => 'getConf', 'uses' => '\App\Http\Controllers\Platform\Conf\MiniappController@get'
	]);
	$router->post('miniapp/update', [
		'as' => 'updateConf', 'uses' => '\App\Http\Controllers\Platform\Conf\MiniappController@update'
	]);
});

$router->group(['prefix' => 'pay/wx'], function () use ($router) {
	// wx
	$router->get('conf/get', [
		'as' => 'getWxPayConf', 'uses' => '\App\Http\Controllers\Pay\WxConfController@get'
	]);
	$router->post('conf/set', [
		'as' => 'setWxPayConf', 'uses' => '\App\Http\Controllers\Pay\WxConfController@set'
	]);
	
});

$router->group(['prefix' => 'pay/wx', 'middleware' => 'auth'], function () use ($router) {
	// wx
	$router->post('pay', [
		'as' => 'wxPay', 'uses' => '\App\Http\Controllers\Pay\WxController@pay'
	]);
	
});

/**上传 */
$router->group(['prefix' => 'upload'], function () use ($router) {
	// upload
	$router->post('file', [
		'as' => 'uploadFile', 'uses' => '\App\Http\Controllers\Upload\FileController@upload'
	]);
	
});

/**用户中心 */
$router->group(['prefix' => 'user', 'middleware' => 'auth'], function () use ($router) {
	// user
	$router->get('info/ofMiniapp', [
		'as' => 'userInfoOfMiniapp', 'uses' => '\App\Http\Controllers\User\InfoController@ofMiniapp'
	]);
	
});